function RemoveMassTauntBuff takes nothing returns nothing
	local timer removeBuffTimer = GetExpiredTimer()
	local unit target = LoadUnitHandle(udg_HT , GetHandleId(removeBuffTimer) , StringHash("REMOVE_MASS_TAUNT_BUFF_TARGET"))
	//--
	call UnitRemoveAbility(target , 'A024')
	call SaveReal(udg_UnitDataHashTable , GetHandleId(target) , StringHash("ADDITIONAL_DAMAGE_PERCENT") , LoadReal(udg_UnitDataHashTable , GetHandleId(target) , StringHash("ADDITIONAL_DAMAGE_PERCENT")) - 20.0)
	call RemoveSavedHandle(udg_UnitDataHashTable , GetHandleId(target) , StringHash("MASS_TAUNT_TIMER"))
	call PauseTimer(removeBuffTimer)
	call FlushChildHashtable(udg_HT , GetHandleId(removeBuffTimer))
	call DestroyTimer(removeBuffTimer)
	//--
	set removeBuffTimer = null
	set target = null
endfunction

function MassTauntEnum takes nothing returns nothing
	local unit target = GetEnumUnit()
	local timer removeBuffTimer = null
	//--
	if IsUnitEnemy(target , udg_TempPlayer) and IsUnitInRangeLoc(target , udg_TempCasterLocation , udg_TempRadius) and not IsUnitType(target , UNIT_TYPE_STRUCTURE) and GetUnitState(target , UNIT_STATE_LIFE) > 0.0 then
		call IssueImmediateOrderById(target , 851972) //停止
		call IssueTargetOrder(target , "attack" , udg_TempCaster)
		call UnitAddAbility(target , 'A024')
		if not HaveSavedHandle(udg_UnitDataHashTable , GetHandleId(target) , StringHash("MASS_TAUNT_TIMER")) then
			set removeBuffTimer = CreateTimer()
			call SaveTimerHandle(udg_UnitDataHashTable , GetHandleId(target) , StringHash("MASS_TAUNT_TIMER") , removeBuffTimer)
			call SaveReal(udg_UnitDataHashTable , GetHandleId(target) , StringHash("ADDITIONAL_DAMAGE_PERCENT") , LoadReal(udg_UnitDataHashTable , GetHandleId(target) , StringHash("ADDITIONAL_DAMAGE_PERCENT")) + 20.0)
			call SaveUnitHandle(udg_HT , GetHandleId(removeBuffTimer) , StringHash("REMOVE_MASS_TAUNT_BUFF_TARGET") , target)
		else
			set removeBuffTimer = LoadTimerHandle(udg_UnitDataHashTable , GetHandleId(target) , StringHash("MASS_TAUNT_TIMER"))
			call PauseTimer(removeBuffTimer)
		endif
		call TimerStart(removeBuffTimer , 5.0 , false , function RemoveMassTauntBuff)
	endif
	//--
	set target = null
	set removeBuffTimer = null
endfunction

function MassTaunt takes nothing returns nothing
	set udg_TempCaster = GetTriggerUnit()
	set udg_TempPlayer = GetOwningPlayer(udg_TempCaster)
	set udg_TempRadius = 500.0
	set udg_TempCasterLocation = GetUnitLoc(udg_TempCaster)
	call For(GetUnitsInRangeOfLocMatching(udg_TempRadius + 70.0 , udg_TempCasterLocation , null) , function MassTauntEnum)
	call RemoveLocation(udg_TempCasterLocation)
	call UnitPlayAnimation(udg_TempCaster , 69 , 1.0 , 2.0)
endfunction

function Trig_MassTauntTry takes nothing returns nothing
	if GetSpellAbilityId() == 'A023' then
		call MassTaunt()
	endif
endfunction

function InitTrig_MassTaunt takes nothing returns nothing
	local hashtable masteryTable = InitHashtable()
	local integer abilityId = 'A023'
	//--	
	//call SaveInteger(udg_AbilityDataHashTable , abilityId , StringHash("NEXT_ABILITY") , 'A01X')
	call SaveInteger(udg_AbilityDataHashTable , abilityId , StringHash("HOTKEY") , StringHash("W"))
	call SaveInteger(udg_AbilityDataHashTable , abilityId , StringHash("MASTERY_ID") , StringHash("MASS_TAUNT_MASTERY"))
	call SaveStr(udg_AbilityDataHashTable , abilityId , StringHash("NAME") , "群體嘲諷")
	call SaveInteger(udg_AbilityDataHashTable , abilityId , StringHash("MAX_LEVEL") , 3)
	call SaveHashtableHandle(udg_AbilityDataHashTable , abilityId , StringHash("LEVEL_MASTERY_TABLE") , masteryTable)
	call SaveReal(masteryTable , 1 , 0 , 4.0) //30
	call SaveReal(masteryTable , 2 , 0 , 8.0) //70
	call SaveReal(masteryTable , 3 , 0 , 16.0) //120
	
	set gg_trg_MassTaunt = CreateTrigger()
	call TriggerRegisterPlayerForceUnitEvent(gg_trg_MassTaunt , EVENT_PLAYER_UNIT_SPELL_EFFECT )
	call TriggerAddAction(gg_trg_MassTaunt , function Trig_MassTauntTry)
	//--
	set masteryTable = null
endfunction